
"""

查看肝脏区域像素点个数占据只包含肝脏区域的slice的百分比
"""

import os
import sys
sys.path.append(os.path.split(sys.path[0])[0])

from tqdm import tqdm
import SimpleITK as sitk

from config import parameter as para
total_point = 0.0
total_liver_point = 0.0

for  i in range(len(os.listdir(para.niiseg_path))-1):
    seg_file=os.listdir(para.niiseg_path)[i]
    seg = sitk.ReadImage(os.path.join(para.niiseg_path, seg_file), sitk.sitkUInt8)
    seg_array = sitk.GetArrayFromImage(seg)

    liver_slice = 0
    print("第{}张seg:".format(str(i)),end="")
    for j in range(len(seg_array)-1):
        slice=seg_array[j]
        if  2 in slice:
            print(j,end=" ")
    print()

# 训练集 6.99%
# 测试集 6.97%
